package com.xiaoye.qbproject.vo.relation;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * @author : ChenYao
 * @version : 1.0
 * @description :
 * @create : 2025-01-06 12:29
 */
@Data
@NoArgsConstructor
public class Line {
    /**
     * 起始点
     */
    private String from;
    /**
     * 指向
     */
    private String to;
    /**
     * 描述
     */
    private String text;

    /**
     * 类型
     */
    private RelationVo.NodeTypeEnum type;

    /**
     * @param from
     * @param to
     * @param text
     * @description:
     * @author: ChenYao
     * @ceateDate: 2025-01-10 2:25
     */

    public Line(String from, String to, String text) {
        this.from = from;
        this.to = to;
        this.text = text;
    }

    /**
     * @param from
     * @param to
     * @param text
     * @param type
     * @description:
     * @author: ChenYao
     * @ceateDate: 2025-01-10 2:25
     */

    public Line(String from, String to, String text, RelationVo.NodeTypeEnum type) {
        this.from = from;
        this.to = to;
        this.text = text;
        this.type = type;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Line line = (Line) o;
        return Objects.equals(from, line.from) && Objects.equals(to, line.to);
    }

    @Override
    public int hashCode() {
        return Objects.hash(from, to);
    }
}
